# !/usr/bin/env python
# coding=utf-8
# @Time    : 2018/1/5 17:32
# @Author  : 6imensiva
# @Site    : https://gitee.com/dimensiva/wx_server_prototype.git
# @File    : pingpp_service.py
# @Software: PyCharm
# @Version: 3.5.4
import pingpp
from configs import current_config


def get_charge(order_no, amount, client_ip, subject, body, open_id):
	pingpp.api_key = current_config.PING_API_KEY
	pingpp.private_key_path = current_config.PING_PRIVATE_KEY_PATH
	ch = pingpp.Charge.create(
		order_no=order_no,
		amount=amount,
		app=dict(id=current_config.PING_APP_ID),
		channel='wx_pub',
		currency='cny',
		client_ip=client_ip,
		subject=subject,
		body=body,
		extra=dict(open_id=open_id)
	)
	return ch


if __name__ == '__main__':
	pingpp.api_key = current_config.PING_API_KEY
	pingpp.private_key_path = current_config.PING_PRIVATE_KEY_PATH
	ch = pingpp.Charge.create(
		order_no='1234567890',
		amount=100,
		app=dict(id=current_config.PING_APP_ID),
		channel='wx_pub',
		currency='cny',
		client_ip='127.0.0.1',
		subject='Your Subject',
		body='Your Body',
		extra=dict(open_id='adasdsad')
	)
	print(ch)